package com.aop.demo.xml;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.springframework.stereotype.Component;

@Component("au")
public class Audience {
    
    public void before(JoinPoint point) {
        System.out.println(point.getSignature().getName());
        System.out.println(point.getTarget().getClass());
        System.out.println("关闭手机");
    }

    public void after() {
        System.out.println("鼓掌......");
    }

    public void throwing() {
        System.out.println("表演太难看了");
    }

    public void leave() {
        System.out.println("观众离场");
    }
    
    public Object proxy(ProceedingJoinPoint pjp) {
    	Object result = null;
    	
    	System.out.println("关闭手机，找座位");
    	try {
			result = pjp.proceed();
			System.out.println("鼓掌......");
		} catch (Throwable e) {
			e.printStackTrace();
			System.out.println("演的太难看了");
		}
    	System.out.println("观众离场");
    	
    	return result;
    }
}
